package edu.ads.bookloan

class ResultStrategyFactory {
	public static ResultStrategy createStrategy(def currentUser){
		if(currentUser.authorities.find{it == "ROLE_EMPLOYEE"}){
			return new EmployeeResultStrategy()
		}
		else if(currentUser.authorities.find{it == "ROLE_STUDENT"}){
			def studentStrategy = new StudentResultStrategy()
			studentStrategy.currentUser = currentUser
			return studentStrategy
		} else{
			return new DefaultResultStrategy()
		}
	}
}
